@use "../abstracts/mixins";

.jenkins-form {
  max-width: var(--form-item-max-width);
}

.jenkins-page-description {
  font-size: 0.9375rem;
  color: var(--text-color-secondary);
  margin: 0 0 var(--section-padding) 0;
  line-height: 1.66;
}

.jenkins-fieldset {
  border: none;
  margin: 0;
  padding: 0;

  .jenkins-form-item:last-of-type {
    margin-bottom: 0;
  }
}

.jenkins-form-item {
  max-width: var(--form-item-max-width);
  margin-bottom: var(--section-padding);

  // Workaround for float:right button controls
  // (eg Global Credentials' Verify Configuration button being hidden by the floating submit bar)
  &::after {
    content: " "; /* Older browser do not support empty content */
    visibility: hidden;
    display: block;
    height: 0;
    clear: both;
  }

  &--tight + .jenkins-form-item--tight {
    margin-top: -0.9rem;
  }

  &--small {
    max-width: var(--form-item-max-width--small);
  }

  &--medium {
    max-width: var(--form-item-max-width--medium);
  }
}

.jenkins-form-label {
  display: flex;
  align-items: center;
  font-weight: var(--form-label-font-weight);
  margin-top: 0;
  margin-bottom: 0.5rem;
  padding-inline: 0;
}

.jenkins-form-description {
  display: block;

  // Tweaked margin so that it appears visually centred when placed next to `.jenkins-form-label`
  margin: -0.2rem 0 0.5rem;
  color: var(--text-color-secondary);
  line-height: 1.66;
}

.jenkins-quote {
  position: relative;
  display: inline-flex;
  align-items: center;
  background-color: var(--button-background);
  border-radius: var(--form-input-border-radius);
  outline: var(--jenkins-border--subtle);
  outline-offset: calc(var(--jenkins-border-width) * -1);
  padding: 0 1rem;
  gap: 1.5rem;

  .jenkins-copy-button {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    margin-right: -0.75rem;
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: calc(var(--form-input-border-radius) - 0.25rem);
  }

  &--monospace {
    font-family: var(--font-family-mono);
  }
}

.jenkins-help-button {
  @include mixins.item;

  --item-background: var(--button-background);

  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-left: 1ch;
  border-radius: 100%;

  span {
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    background: var(--text-color);
    color: transparent;
    mask-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='262px' height='482px' viewBox='0 0 262 482' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpath d='M69.9217381,109.622622 L69.9347383,109.509526 L69.9838606,109.158807 L70.0463523,108.766768 C70.2927563,107.286617 70.7336,105.509397 71.3554148,103.600821 C73.4488365,97.1753443 76.974163,91.0239622 81.9750299,85.3670497 C84.5508811,82.453282 87.4853512,79.7201177 90.8001215,77.1662697 C100.73686,69.5111158 114.003751,65.6584363 131.476234,65.4354882 C133.731084,65.4096204 135.996257,65.4453704 138.232058,65.5407008 L139.478148,65.6000218 C140.992957,65.679511 142.536904,65.7906863 144.04662,65.9294921 L145.210323,66.0424992 C145.886163,66.1116384 146.60564,66.1925244 147.313561,66.2795642 L148.414194,66.420922 L149.377674,66.5545415 L150.375686,66.7050246 L151.398071,66.8714663 L152.049055,66.9841252 L152.731845,67.1083183 L153.642724,67.2845248 L154.549432,67.4714994 C155.036905,67.5756456 155.574038,67.6978797 156.090422,67.8232778 L156.917997,68.0311744 C158.666031,68.484436 160.136789,68.9816723 161.141416,69.4394425 C170.146558,73.5618171 177.044937,78.1235016 182.224862,83.4639805 C188.857993,90.3027083 191.999176,97.8308192 191.999176,107.499034 C191.999176,119.466025 188.796962,127.918279 181.370643,136.250976 C181.093904,136.561492 180.816698,136.867422 180.538309,137.169526 L180.089688,137.652102 L179.736214,138.026258 L179.002023,138.784568 L178.579132,139.213445 L178.134441,139.655368 L177.707007,140.071619 L177.021999,140.726828 L176.298991,141.400731 L175.788688,141.867317 L175.318979,142.286805 L174.54297,142.970055 L173.990783,143.446079 L173.448394,143.905722 L172.625948,144.588916 L171.799887,145.262466 L170.811596,146.050172 L169.864089,146.789794 L169.222049,147.28309 L168.549302,147.793886 L167.493519,148.583956 L166.782836,149.108414 L165.65246,149.931951 L164.484527,150.770371 L163.266904,151.632649 L161.555386,152.827104 L160.682666,153.429152 L159.298283,154.375903 L157.864408,155.346877 L155.333592,157.040637 L153.750968,158.088827 L151.524574,159.551762 L148.580787,161.468911 L144.800696,163.908618 C105.775292,188.991858 87.997951,218.376069 87.997951,257.047472 L87.997951,283.286279 L88.0016284,283.748414 C88.3121212,301.66652 103.883328,316 122.998363,316 C142.328557,316 157.998775,301.353568 157.998775,283.286279 L157.998775,257.047472 L158.001383,256.432449 C158.064604,248.820487 159.375708,243.378146 162.208358,238.456376 C165.925109,231.998468 172.860638,225.357973 183.865352,218.206756 L186.747913,216.348707 L189.667785,214.457346 L192.470459,212.628123 L195.158954,210.857753 L197.739048,209.141153 L199.612339,207.881962 L201.424999,206.651521 L203.184757,205.444126 L204.893987,204.257626 L206.014818,203.471391 L207.63679,202.320739 L208.708154,201.551674 L209.751591,200.795045 L210.776652,200.043916 L211.783987,199.29767 L212.774236,198.555696 L213.748026,197.81739 L214.705977,197.082156 L215.983535,196.08689 L217.035512,195.253661 L217.94273,194.524595 L218.836751,193.796023 L219.718133,193.067399 L220.587422,192.33819 L221.445157,191.607874 L222.291869,190.87594 L223.128081,190.141889 L224.349696,189.048475 L225.176062,188.294328 L225.979581,187.549096 L227.15568,186.436436 L227.953672,185.666523 L228.73078,184.904536 L229.501513,184.136777 L230.633743,182.986693 L231.403964,182.189294 L232.15663,181.397931 L232.905389,180.598844 L233.650817,179.791592 L234.393505,178.975725 L235.134055,178.150785 C253.063009,158.033696 262,134.778085 262,107.499034 C262,81.4013251 252.315995,58.3143983 234.08637,39.5197386 C222.737894,27.8195118 209.350637,18.7642961 192.813373,11.0878005 L191.857565,10.6472715 C176.144833,3.48753386 154.016249,-0.255558118 130.568693,0.0135609187 C97.385459,0.43694412 69.212387,9.00946009 46.2762841,26.6791815 C39.5211589,31.8836333 33.4271839,37.5663685 28.0119541,43.6920026 C17.038175,56.105392 9.16079603,69.8997291 4.39056696,84.5413054 C2.80350137,89.4125897 1.62984552,94.1870463 0.865737279,98.781619 L0.782196688,99.2931802 L0.614828552,100.383438 L0.559658337,100.765066 L0.426811303,101.749189 L0.318522027,102.638537 L0.226704214,103.487005 L0.123646908,104.617718 L0.0652556787,105.43714 L0.0342145373,105.994277 C-0.81250758,124.122996 14.1596716,139.394013 33.4714881,140.181654 L33.9656162,140.198367 L34.5332314,140.20872 C53.0445487,140.409453 68.5022596,127.170521 69.8964399,109.989591 L69.9217381,109.622622 Z' fill='currentColor' fill-rule='nonzero'%3E%3C/path%3E%3Ccircle fill='currentColor' cx='123' cy='434' r='48'%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");
    mask-size: 45% 45%;
    mask-position: center;
    mask-repeat: no-repeat;
  }
}

.jenkins-select-help {
  position: relative;
}

.jenkins-select-help a.jenkins-help-button {
  position: absolute;
  top: -3.7rem;
  right: -2rem;
}

.jenkins-edited-section-label {
  color: var(--text-color-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  cursor: default;

  svg {
    width: 1rem;
    height: 1rem;
  }
}

.jenkins-instructions {
  display: flex;
  flex-direction: column;
  list-style-type: none;
  padding: 0;
  margin: 0 0 var(--section-padding);
  gap: var(--section-padding);
  counter-reset: section;

  li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
    padding-left: 3rem;
    padding-top: 0.35rem;

    .jenkins-instructions__label {
      font-weight: var(--font-bold-weight);
      margin: 0;
    }

    &::before {
      counter-increment: section;
      content: counters(section, "");
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      top: 0;
      left: 0;
      background: var(--text-color);
      width: 2rem;
      height: 2rem;
      color: var(--background);
      border-radius: 100px;
      text-align: center;
      font-weight: var(--font-bold-weight);
    }
  }
}
